//
//  CommunCollectionReusableView.m
//  WhereToTravel
//
//  Created by dllo on 15/10/14.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "CommunCollectionReusableView.h"

@implementation CommunCollectionReusableView
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"night" object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(night) name:@"night" object:nil];
        
        self.labelBeat = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 375 * WIDTH, 30 * HEIGHT)];
        self.labelBeat.backgroundColor = [UIColor blackColor];
        [self addSubview:_labelBeat];
        self.labelBeat.alpha = 0.4;
        self.labelBeat.textColor = [UIColor whiteColor];
        
        self.viewLine = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375 * WIDTH, 1 * HEIGHT)];
        self.viewLine.backgroundColor = [UIColor blackColor];
        self.viewLine.alpha = 0.3;
        [self addSubview:self.viewLine];
        
        [self.labelBeat mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self);
            
        }];
    }
    
    return self;
}

- (void)night {
    if ([SingletonNight shareSingletonNight].isSelete == YES) {
        self.labelBeat.backgroundColor = [UIColor whiteColor];
        self.viewLine.backgroundColor = [UIColor whiteColor];
        self.labelBeat.textColor = [UIColor blackColor];
    }
    else {
        self.labelBeat.backgroundColor = [UIColor blackColor];
        self.viewLine.backgroundColor = [UIColor blackColor];
        self.labelBeat.textColor = [UIColor whiteColor];
    }
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"night" object:nil];
}

@end
